﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using BindingOriented.Adapters.Demo.ObjectModel;
using WpfApplication1.ViewModel;

namespace WpfApplication1
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
#if  OLD
        public static List<Contact> dd = new List<Contact>()
            {
                new Contact(1){Title ="1",FirstName ="",LastName="3",Age=10,AgeLarge =2223},
                new Contact(2){Title ="11",FirstName ="21",LastName="31",Age=11,AgeLarge =2223},
                new Contact(3){Title ="111",FirstName ="211",LastName="311",Age=12,AgeLarge =2223},
            };
#else
        public static List<ContactNew> dd = new List<ContactNew>()
            {
                new ContactNew(1){Title ="1",FirstName ="",LastName="3",Age=10,AgeLarge =2223},
                new ContactNew(2){Title ="11",FirstName ="21",LastName="31",Age=11,AgeLarge =2223},
                new ContactNew(3){Title ="111",FirstName ="211",LastName="311",Age=12,AgeLarge =2223},
                new ContactNew(4){Title ="1111",FirstName ="2111",LastName="3111",Age=13,AgeLarge =2223},
            };
#endif


        public MainWindow()
        {
            ComboBox comboBox = new ComboBox();
            var d = comboBox.GetValue(ListBox.SelectionModeProperty);

            System.Diagnostics.Debug.WriteLine(comboBox.GetValue(ListBox.SelectionModeProperty));
            //UIElement.IsEnabledProperty.OverrideMetadata
            InitializeComponent();
            DataContext = dd;

        }

        private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
#if  OLD
            var selectedContact = ((sender as DataGrid).SelectedValue as Contact);
            Reg reg = new Reg(new EditableContact(selectedContact));
#else
            var selectedContactNew = ((sender as DataGrid).SelectedValue as ContactNew);
            Reg reg = new Reg(new EditableContactViewModel(selectedContactNew));
#endif

            reg.ShowDialog();
        }

    }
}

namespace MyNamespace
{
    public class prograss
    {
        public void Main()
        {
            //System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode()
            dynamic a = 0;
            M(a);
        }

        void M(int a)
        { }
        void M(string a) { }
    }

    public class Employee
    {
    }

    public class MyClass : IL<int>
    {

        //public void Call(int t)
        //{
        //    System.Diagnostics.Debug.WriteLine(t,"out");
        //}
        public int Call()
        {
            System.Diagnostics.Debug.WriteLine(1, "out");
            return 1;
        }
    }

    //interface IL<out Treturn>
    //{
    //    void Call(Treturn t);
    //}

    interface IL<out Treturn>
    {
        Treturn Call();
    }
}
